import requests


class LoginApi(object):
    def login(self, req_body):
        resp = requests.post(url="http://ihrm2-test.itheima.net/api/sys/login",
                      json=req_body)
        return resp

if __name__ == '__main__':
    # 创建实例
    ihrm = LoginApi()
    # 准备请求体数据
    req_body = {"mobile":"13800000002","password":"123456"}
    # 调用实例方法
    resp = ihrm.login(req_body)
    # 打印响应结果
    print("登录结果：", resp.json())